package com.copc.controller;

import com.copc.common.model.order.OrderVo;
import com.copc.common.model.vo.*;
import com.copc.service.IsvDouyinService;
import io.swagger.annotations.Api;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.net.URISyntaxException;
import java.util.List;

/**
 * 1.查询订单详情
 */
@Api("抖音接口")
@RestController
@RequestMapping("/isv")
@Log4j2
public class IsvDouyinOrderController {

    @Autowired
    private IsvDouyinService isvDouyinService;

    /**
     *订单详情
     * */
    @RequestMapping(value = "/orderDetail")
    public OrderVo douYinRefund(HttpServletRequest request) throws URISyntaxException {

        String orderId = request.getParameter("orderId");
        String accountId = request.getParameter("account_id");
        OrderVo order = isvDouyinService.orderDetal(orderId,accountId);
        return order;
    }


    /**
     *商品价格
     * */
    @RequestMapping(value = "merchandise/prices")
    public MerPriceVo merchandisePrices(HttpServletRequest request) throws URISyntaxException {

        String code = request.getParameter("code");
        String accountId = request.getParameter("account_id");
        MerPriceVo merPriceVo = isvDouyinService.merchandisePrices(code,accountId);
        return merPriceVo;
    }

    /**
     *产品照片
     * */
    @RequestMapping(value = "order/product")
    public ProductsVo orderProduct(HttpServletRequest request) throws URISyntaxException {

        String orderNo = request.getParameter("orderNo");
        String accountId = request.getParameter("account_id");
        ProductsVo productsVo = isvDouyinService.getOrderProduct(orderNo,accountId);
        return productsVo;
    }

    /**
     *产品照片
     * */
    @RequestMapping(value = "product/pictures")
    public OdrPictures productPictures(HttpServletRequest request) throws URISyntaxException {

        String productId = request.getParameter("productId");
        String accountId = request.getParameter("account_id");
        OdrPictures odrPictures = isvDouyinService.getProductPictures(productId,accountId);
        return odrPictures;
    }

    /**
     *物流信息
     * */
    @RequestMapping(value = "order/express")
    public ExpressRouteVo orderExpress(HttpServletRequest request) throws URISyntaxException {

        String orderNo = request.getParameter("orderNo");
        String accountId = request.getParameter("account_id");
        ExpressRouteVo expressRouteVo = isvDouyinService.getOrderExpress(orderNo,accountId);
        return expressRouteVo;
    }

    /**
     *物流跟踪信息
     * */
    @RequestMapping(value = "express/tracking")
    public Routes tracking(HttpServletRequest request) throws URISyntaxException {

        String expressNo = request.getParameter("expressNo");
        String accountId = request.getParameter("account_id");
        Routes routes = isvDouyinService.getTracking(expressNo,accountId);
        return routes;
    }

}
